package com.kt.app.ui.components


import android.util.Log
import androidx.compose.foundation.layout.Column
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue


@Composable
fun LifeCycleSample() {
    var count by remember { mutableStateOf(0) }
    LaunchedEffect(Unit){
        Log.i("LifeCycleSample","LaunchedEffect")
    }
    Log.i("LifeCycleSample","LaunchedEffect2")

    Column {
        Text("Text $count")
        Button(onClick = {
            count+=1
        }) {
            Text("点击我")

        }
    }

}

@Preview
@Composable
fun LifeCycleSamplePreview() {
    LifeCycleSample()
}

